<template>
  <div class="shc_login_box_container">
    <div class="shc_input_box_container">
      <div class="shc_top_box_container">
        <p>UNI-ADMIN</p>
      </div>
      <div class="shc_bottom_box_contaienr">
        <div class="shc_bottom_input_box_container">
          <el-form
            :label-position="labelPosition"
            label-width="80px"
            :model="form"
            class="from"
          >
            <el-form-item label="">
              <el-input v-model="form.user"></el-input>
            </el-form-item>
            <el-form-item label="">
              <el-input v-model="form.pass"></el-input>
            </el-form-item>
          </el-form>
          <div class="shc_botton_box_container">
            <button class="onclick" @click="onClick">立即登录</button>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
// import axios from "axios";
export default {
  data() {
    return {
      labelPosition: "right",
      form: {
        user: "",
        pass: "",
      },
    };
  },
  methods: {
    onClick() {
      this.$axios
        .post("http://ceshi5.dishait.cn/admin/login", {
          username: this.form.user,
          password: this.form.pass,
        })
        .then((res) => {
          localStorage.setItem("token", res.data.data.token);
          this.$router.push({ path: "/page/" });
        })
        .catch(() => {
          console.log("登陆失败");
          alert("账户或密码错误");
        });
    },
  },

};
</script>
<style lang="scss">
* {
  margin: 0;
  padding: 0;
}
.shc_login_box_container {
  width: 100vw;
  height: 100vh;
  background-color: #f4f4f4;
  display: inline-flex;
  justify-content: center;
  align-items: center;
}
.shc_input_box_container {
  width: 500px;
  height: 300px;
  // background-color: gold;
  border: 1px solid;
}
.shc_top_box_container {
  width: 100%;
  height: 20%;
  // background-color: gold;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  font-size: 20px;
  font-weight: 700;
  color: #6e7681;
  border-bottom: 1px solid;
}
.shc_bottom_box_contaienr {
  width: 100%;
  height: 80%;
  // background-color: skyblue;
  display: inline-flex;
  justify-content: center;
  align-items: center;
}
.shc_bottom_input_box_container {
  width: 100%;
  height: 200px;
  // background-color: red;
}
.from {
  margin-right: 60px;
}
.shc_botton_box_container {
  width: 100%;
  height: 50px;
  // background-color: springgreen;
  margin-top: 30px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
}
.ipt {
  width: 100%;
  height: 30px;
}
.onclick {
  width: 90%;
  height: 30px;
  color: #fff;
  border: 0;
  // outline: none;
  background-color: #068080;
}
</style>